home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1991-09-09 | 3.5 KB | 131 lines |
- Rem ---------------------------------------------------------
- Rem - TAME (Total Amiga Map Editor) -
- Rem - -
- Rem - Programmed by Aaron Fothergill -
- Rem - (c) Mandarin / Jawx 1990 -
- Rem ---------------------------------------------------------
- MXLN=10
- Rem screen height and width
- SCH=200
- SCW=320
- Dir$="AMOS_DATA:MAGIC_FOREST/"
- OK=0
- F$=Fsel$("*.ABK","MFTILES.ABK","Pick a tile screen")
- F$=Upper$(F$)
- If F$="" Then End
- If Exist(F$)
- If Right$(F$,4)=".ABK"
- Load F$,5
- Unpack 5 To 2
- OK=1
- Erase 5
- Else
- Load Iff F$,2
- OK=1
- End If
- End If
- If OK=0 Then End
- F$=Fsel$("*.MAP","MAGICFOREST1.MAP","Pick a Map file")
- If F$="" Then End
- If Exist(F$)
- Open In 1,F$
- L=Lof(1)
- Close 1
- Reserve As Work 6,L
- Bload F$,Start(6)
- OK=1
- End If
- If OK=0 Then End
- TAMEVIEW[0,0,10,6,32,32]
- GTBLCKS
- Auto View Off
- While OK=1
- Rem display the map on screen 0
- TAMEMAP[0,X,Y]
- Rem then copy it to screen 2 (front)
- Screen Copy 0,0,0,320,192 To 2,0,0
- View
- Rem check joystick for movement
- If Jleft(1) and X>0 Then Dec X
- If Jright(1) and X<MAPX-TAMEW Then Inc X
- If Jup(1) and Y>0 Then Dec Y
- If Jdown(1) and Y<MAPY-TAMEH Then Inc Y
- Wend
- Rem the parameters for the TAMEVIEW procedure are
- Rem TX,TY,TW,TH,XS,YS these are
- Rem TX is the top left X co-ordinate of the map display area
- Rem TY is the top left Y " " " " " " "
- Rem TW is the width in tiles
- Rem TH is the height in tiles
- Rem XS and YS are the X & Y sizes of the tiles
- Procedure GTBLCKS
- Rem This routine converts a screen (screen 2) into icons for use by TAME
- Rem XSIZE & YSIZE determine the block size (and thus the number of them)
- Shared XSIZE,YSIZE,XSO,YSO,ICDONE,NCOLS,REZ,SCW,SCH,MXLN
- Screen 0
- Get Palette(2)
- Screen 2
- XSO=XSIZE
- YSO=YSIZE
- A=0
- Repeat
- B=0
- Repeat
- Get Block A*(SCW/XSIZE)+B+1,B*XSIZE,A*YSIZE,XSIZE,YSIZE
- Inc B
- Until B>=SCW/XSIZE
- Inc A
- Until A>=SCH/YSIZE or A>MXLN
- Screen 0
- ICDONE=1
- Cls 0
- End Proc
- Procedure TAMEVIEW[TX,TY,TW,TH,XS,YS]
- Rem This routine sets up the window for TAME, and what size tiles you wish
- Rem to use
- Shared XSIZE,YSIZE,MAPX,MAPY,TAMEW,TAMEH,TLX,TLY,BRX,BRY
- M$="TAME Map"
- MAPX=Deek(Start(6)) : MAPY=Deek(Start(6)+2)
- XSIZE=XS : YSIZE=YS
- TLX=TX : TLY=TY
- TAMEW=TW : TAMEH=TH
- BRX=TLX+TW*(XSIZE-1)
- BRY=TLY+TH*(YSIZE-1)
- S6=Start(6)+4+MAPX*MAPY
- Doke S6,XSIZE : Doke S6+2,YSIZE
- Doke S6+4,TLX : Doke S6+6,TLY
- Doke S6+8,TAMEW : Doke S6+10,TAMEH
- Doke S6+12,BRX : Doke S6+14,BRY
- A=0 : Repeat : Poke Start(6)-8+A,Asc(Mid$(M$,A+1,1)) : Inc A : Until A=8
- End Proc
- Procedure TAMEMAP[S,X,Y]
- Rem This routine draws the map in the window set by the TAMEVIEW procedure
- Rem on screen S, at map co-ordinates X,Y
- Shared BL,MXTOS,XSIZE,YSIZE,TLX,TLY,TAMEW,TAMEH,BRX,BRY,MXLN
- MXTOS=MXLN*320/XSIZE-1
- MAPX=Deek(Start(6)) : MAPY=Deek(Start(6)+2)
- S6=Start(6)+MAPX*MAPY+4
- XSIZE=Deek(S6) : YSIZE=Deek(S6+2)
- TLX=Deek(S6+4) : TLY=Deek(S6+6)
- TAMEW=Deek(S6+8) : TAMEH=Deek(S6+10)
- BRX=Deek(S6+12) : BRY=Deek(S6+14)
- TEMP=Screen
- Screen S
- S6=Start(6)+4
- WI=TAMEW*XSIZE
- HI=TAMEH*YSIZE
- MAPZ=MAPX*MAPY
- A=0 : A2=Y*MAPX
- Repeat
- A2=A2 mod MAPZ
- B=0 : B2=X
- Repeat
- BL=Peek(S6+(B2 mod MAPX)+A2)
- Put Block 1+Min(MXTOS,BL),TLX+B,TLY+A
- Add B,XSIZE : Inc B2
- Until B>=WI
- Add A,YSIZE : Add A2,MAPX
- Until A>=HI
- Screen Copy S,TLX,TLY,BRX,BRY To TEMP,TLX,TLY
- Screen TEMP
- End Proc